﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="AddStudentGrades.aspx.vb" Inherits="DARSClients.AddStudentGrades" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Beyond DARS - Add Grades</title>
    <link id="myCSS" href="Styles/myStyle.css" rel="stylesheet" type="text/css" />

    <style type="text/css">
        .style1
        {
            width: 253px;
        }
        .style2
        {
            height: 110px;
        }
        </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
                    <asp:Label ID="lblTitle" runat="server" Text="Update Student Grades" 
            CssClass="title-nav" Width="755px"></asp:Label>
                    <br />
        <br />
        <br />
        <br />
    
        <table style="width: 800px;" class="content">
            <tr>
                <td class="style1" 
                    style="border-width: thin; padding: 10px; border-style: dashed;" valign="top" 
                    align="right" rowspan="2">
                    <asp:Label ID="lblStudentID" runat="server" Text="Student ID:" 
                        CssClass="content"></asp:Label>
&nbsp;<asp:TextBox ID="txtStudentID" runat="server" Width="126px"></asp:TextBox>
                    <br />
                    <asp:Button ID="btnSubmit" runat="server" Text="Submit" />
                    <br />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
                    <asp:Label ID="lblChooseSem" runat="server" Text="Choose Semester:" 
                        CssClass="content"></asp:Label>
&nbsp;<asp:DropDownList ID="ddlSemester" runat="server" DataSourceID="SqlDataSource1" 
                        DataTextField="SemesterTaken" DataValueField="SemesterTaken" 
                        AutoPostBack="True">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:FA11_4296_BeyondDARSConnectionString %>" 
                        SelectCommand="SELECT DISTINCT [SemesterTaken] FROM [StudentCourse] WHERE ([StudentID] = @StudentID)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="txtStudentID" Name="StudentID" 
                                PropertyName="Text" Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    <br />
                    <br />
                    <br />
                </td>
                <td style="border-width: thin; padding: 10px; border-style: dashed;" 
                    valign="top" align="left">
&nbsp;<asp:Label ID="lblShowName" runat="server" Text="Label" Width="271px"></asp:Label>
&nbsp;
                </td>
                <td style="border-width: thin; padding: 10px; border-style: dashed;" 
                    valign="top" align="left">
                    <asp:Label ID="lblShowSemester" runat="server" Text="Label"></asp:Label>
                </td>
            </tr>
            <tr>
                <td colspan="2" 
                    style="border-width: thin; padding: 10px; border-style: dashed;" valign="top" 
                    align="left">
                    <asp:GridView ID="gvSemesterCourses" runat="server" AutoGenerateColumns="False" 
                        CssClass="style2" DataSourceID="SqlDataSource3" 
                        AutoGenerateEditButton="True" DataKeyNames="CourseID,AttemptNumber,StudentID">
                        <Columns>
                            <asp:BoundField DataField="CourseID" HeaderText="CourseID" 
                                SortExpression="CourseID" ReadOnly="True" />
                            <asp:BoundField DataField="AttemptNumber" HeaderText="AttemptNumber" 
                                SortExpression="AttemptNumber" ReadOnly="True" />
                            <asp:BoundField DataField="GradeEarned" HeaderText="GradeEarned" 
                                SortExpression="GradeEarned" />
                            <asp:BoundField DataField="StudentID" HeaderText="StudentID" ReadOnly="True" 
                                SortExpression="StudentID" Visible="False" />
                        </Columns>
                        <EmptyDataTemplate>
                            <asp:CheckBox ID="cbSelect" runat="server" />
                        </EmptyDataTemplate>
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:FA11_4296_BeyondDARSConnectionString %>" 
                        InsertCommand="INSERT INTO [StudentCourse] ([CourseID], [AttemptNumber], [GradeEarned], [StudentID]) VALUES (@CourseID, @AttemptNumber, @GradeEarned, @StudentID)" 
                        SelectCommand="SELECT [CourseID], [AttemptNumber], [GradeEarned], [StudentID] FROM [StudentCourse] WHERE (([SemesterTaken] = @SemesterTaken) AND ([StudentID] = @StudentID2))" 
                        UpdateCommand="UPDATE [StudentCourse] SET [GradeEarned] = @GradeEarned, [AttemptNumber]=[AttemptNumber] + 1 WHERE [CourseID] = @CourseID AND [StudentID] = @StudentID">
                        <DeleteParameters>
                            <asp:Parameter Name="CourseID" Type="String" />
                            <asp:Parameter Name="AttemptNumber" Type="Int32" />
                            <asp:Parameter Name="StudentID" Type="String" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="CourseID" Type="String" />
                            <asp:Parameter Name="AttemptNumber" Type="Int32" />
                            <asp:Parameter Name="GradeEarned" Type="String" />
                            <asp:Parameter Name="StudentID" Type="String" />
                        </InsertParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="ddlSemester" Name="SemesterTaken" 
                                PropertyName="SelectedValue" Type="String" />
                            <asp:ControlParameter ControlID="txtStudentID" Name="StudentID2" 
                                PropertyName="Text" Type="String" />
                        </SelectParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="GradeEarned" Type="String" />
                            <asp:Parameter Name="CourseID" Type="String" />
                            <asp:Parameter Name="AttemptNumber" Type="Int32" />
                            <asp:Parameter Name="StudentID" Type="String" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            </table>
    
    </div>
    <div class="footer">
        <a><input  type="submit" class="text_button" id="btnLogout" runat="server" 
                value="Logout" causesvalidation="False" />
           <input type="submit" class="text_button" id="btnhome" runat="server" 
                value="Home" causesvalidation="False" /> </a>
        </div>
    </form>
</body>
</html>
